package com.tony.business.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tony.business.service.AdminMenuService;
import com.tony.domain.bo.JsonResult;
import com.tony.domain.dto.SelectAdminMenuPageDTO;
import com.tony.domain.vo.AdminMenuPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


@Api(tags = "系统菜单相关")
@RestController
@RequestMapping("/adminMenu")
public class AdminMenuController extends BaseController {

    @Autowired
    private AdminMenuService adminMenuService;

    @GetMapping("/page")
    @ApiOperation(value = "查询菜单分页", httpMethod = "GET")
    public JsonResult<Page<AdminMenuPageVO>> page(@Validated SelectAdminMenuPageDTO adminMenuPageDTO) {
        return adminMenuService.selectAdminMenuPage(adminMenuPageDTO);
    }

    @DeleteMapping("/{id}")
    @ApiOperation(value = "删除菜单", httpMethod = "DELETE")
    public JsonResult<Boolean> delete(@PathVariable("id") Long id) {
        return new JsonResult<>(adminMenuService.removeById(id));
    }
}
